package com.sanuo.pico.act.work;


import android.os.Bundle;
import android.view.View;

import androidx.annotation.Nullable;

import com.menu.app.activity.base.MenuBaseActivity;
import com.menu.app.model.Models;
import com.menu.app.util.Utils;
import com.sanuo.pico.App;
import com.sanuo.pico.databinding.ActInfoBinding;
import com.sanuo.pico.utils.Command;
import com.sanuo.pico.utils.PortPipe;

public class InfoActivity extends MenuBaseActivity {

    ActInfoBinding binding;

    @Override
    protected boolean enableMenu() {
        return false;
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = ActInfoBinding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());

        binding.back.setOnClickListener(v -> finish());
        initBall(binding.frame);

        binding.msn.setOnClickListener(v -> {
            App.getApp().setIgnore(false);
            h.removeCallbacksAndMessages(null);
            h.post(new Runnable() {
                @Override
                public void run() {
                    Command.sendTouchEvent(0, 0x13);
                    h.postDelayed(this, 100);
                }
            });
        });
    }

    @Override
    protected void onPause() {
        super.onPause();
        h.removeCallbacksAndMessages(null);
    }

    @Override
    protected void onResume() {
        super.onResume();
        App.getApp().setIgnore(true);
        PortPipe.getInstance().goBack(null);

        binding.msn.setText(Utils.getMsn());
        if (Models.Companion.get().getRentEvent().getValue() == 1) {
            binding.rentLayout.setVisibility(View.VISIBLE);
            binding.rent.setText(Models.Companion.get().getPointEvent().getValue() + "");
        } else {
            binding.rentLayout.setVisibility(View.INVISIBLE);
        }
    }

    @Override
    protected byte[][] getInterest() {
        return new byte[0][];
    }

    @Override
    protected void updateUI() {

    }

    @Override
    public void exit() {

    }

    @Override
    public String getPageIndex() {
        return null;
    }
}
